namespace Xsxiaosa.Net
{
    using System;
    using System.Net.Sockets;

    public class ProxySocketException : Exception
    {
        // Methods
        public ProxySocketException(SocketException e) : base(ProxySocketException.GetSocketExceptionMessage(e), e)
        {
            this._status = ProxySocketExceptionStatus.UnclassifiableError;
            this._errorCode = 0;
            this._errorCode = e.ErrorCode;
            int num1 = e.ErrorCode;
            if (num1 == 10057)
            {
                this._status = ProxySocketExceptionStatus.NotConnected;
                return;
            }
            this._status = ProxySocketExceptionStatus.SocketError;
        }

        public ProxySocketException(string message, ProxySocketExceptionStatus status) : base(message)
        {
            this._status = ProxySocketExceptionStatus.UnclassifiableError;
            this._errorCode = 0;
            this._status = status;
        }

        public ProxySocketException(string message, ProxySocketExceptionStatus status, Exception innerException) : base(message, innerException)
        {
            this._status = ProxySocketExceptionStatus.UnclassifiableError;
            this._errorCode = 0;
            this._status = status;
        }

        private static string GetSocketExceptionMessage(SocketException e)
        {
            int num1 = e.ErrorCode;
            if (num1 == 10057)
            {
                return Messages.GetString(typeof(ProxySocketStrings), "NotConnected");
            }
            return string.Format("Socket error {0}: {1}", e.ErrorCode, e.Message);
        }


        // Properties
        public int ErrorCode
        {
            get
            {
                return this._errorCode;
            }
        }

        public ProxySocketExceptionStatus Status
        {
            get
            {
                return this._status;
            }
        }


        // Fields
        private int _errorCode;
        private ProxySocketExceptionStatus _status;
        private const int WSAENOTCONN = 10057;
    }}

